package com.dingwen.spsest.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dingwen.spsest.entity.MenuEntity;
import com.dingwen.spsest.mapper.MenuMapper;
import com.dingwen.spsest.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * menu service impl
 *
 * @author dingwen
 * 2021.05.18 15:57
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuEntity> implements MenuService {

    /**
     * 菜单映射器
     */
    private final MenuMapper menuMapper;

    @Autowired
    public MenuServiceImpl(MenuMapper menuMapper) {
      this.menuMapper = menuMapper;
    }

    /**
     * 根据用户ID查询菜单信息
     *
     * @param userId 用户id
     * @return {@link List<MenuEntity>}
     */
    @Override
    public List<MenuEntity> selectMenuByUserId(Integer userId) {
        return menuMapper.selectMenuByUserId(userId);
    }
}
